﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using Public;

namespace Dal
{
    public class ConfigInfo
    {
        public static DataTable MULTIPLE(string strCon)
        {
            DataTable dt = new DataTable();
            dt.Locale = CultureInfo.InvariantCulture;

            try
            {
                dt = SqlHelper.ExecuteDataTable(DataProtector.DecryptString(strCon), CommandType.StoredProcedure, "SP_ConfigInfo_MULTIPLE");
            }
            catch
            {
                throw;
            }
            return dt;
        }

        public static int Update(string strCon,
                string txbSiteName,
                string txbSiteKeywords,
                string txbSiteDescription,
                string txbSiteICP,
                string txbHotLine,
                string txbEmail,
                int txbIsOpen,
                int txbIsReg)
        {
            int rtn = 0;
            SqlParameter[] pars = new SqlParameter[8];
            pars[0] = new SqlParameter("@SiteName", SqlDbType.NVarChar,200);
            pars[0].Value = txbSiteName;
            pars[1] = new SqlParameter("@SiteKeywords", SqlDbType.NVarChar,200);
            pars[1].Value = txbSiteKeywords;
            pars[2] = new SqlParameter("@SiteDescription", SqlDbType.NVarChar,200);
            pars[2].Value = txbSiteDescription;
            pars[3] = new SqlParameter("@SiteICP", SqlDbType.NVarChar, 50);
            pars[3].Value = txbSiteICP;
            pars[4] = new SqlParameter("@HotLine", SqlDbType.NVarChar, 50);
            pars[4].Value = txbHotLine;
            pars[5] = new SqlParameter("@Email", SqlDbType.NVarChar, 50);
            pars[5].Value = txbEmail;
            pars[6] = new SqlParameter("@IsOpen", SqlDbType.Int);
            pars[6].Value = txbIsOpen;
            pars[7] = new SqlParameter("@IsReg", SqlDbType.Int);
            pars[7].Value = txbIsReg;

            try
            {
                rtn = SqlHelper.ExecuteNonQuery(DataProtector.DecryptString(strCon), CommandType.StoredProcedure, "SP_ConfigInfo_UPDATE", pars);
            }
            catch
            {
                throw;
            }
            return rtn;
        }
    }
}
